#ifndef _PARTHUS_UT_ATS_COMMON_H
#define _PARTHUS_UT_ATS_COMMON_H
/*************************************************************************
 * MODULE NAME:    ut_ats_common.h
 * PROJECT CODE:    BlueStream
 * DESCRIPTION:    Prototypes re-used tests and test helper functions
 * MAINTAINER:     John Nelson
 * DATE:           12 Nov 2002
 *
 * SOURCE CONTROL: $Id: ut_ats_common.h,v 1.1 2008/02/03 09:39:24 james Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2002-2004 Ceva Inc.
 *     All rights reserved.
 *
 * REVISION HISTORY:
 *    V1.0     12 Nov  2002 -   jn     - Initial Version 
 *
 * SOURCE: 
 * ISSUES:
 *      This module contains all external function prototypes required
 *      for test case/helper function access.
 *
 *************************************************************************/
/*
 * Module: test_tp_lih_sco.c        SCO functions
 */
extern t_error _TP_LIH_Tester_Master_Setup_SCO( 
    u_int8 sco_connection_number, t_packet sco_packet, u_int32 num_sco_frames);
extern t_error _TP_LIH_Tester_Slave_Setup_SCO(
    u_int8 sco_connection_number, t_packet sco_packet, u_int32 num_sco_frames);
extern t_error _TP_LIH_IUT_Master_Setup_SCO(
    u_int8 sco_connection_number, t_packet sco_packet, u_int32 num_sco_frames);
extern t_error _TP_LIH_IUT_Slave_Setup_SCO(
    u_int8 sco_connection_number, t_packet sco_packet, u_int32 num_sco_frames);

extern t_error _TP_LIH_Tester_Master_Remove_SCO(u_int8 sco_connection_number);
extern t_error _TP_LIH_Tester_Slave_Remove_SCO(u_int8 sco_connection_number);
extern t_error _TP_LIH_IUT_Master_Remove_SCO(u_int8 sco_connection_number);
extern t_error _TP_LIH_IUT_Slave_Remove_SCO(u_int8 sco_connection_number);
         
extern t_error _TP_LIH_IUT_Setup_SCO(
    u_int8 sco_connection_number, t_packet sco_packet, u_int32 num_sco_frames);
extern t_error _TP_LIH_IUT_Remove_SCO(u_int8 sco_connection_number);
extern t_error _TP_LIH_Tester_Setup_SCO(
    u_int8 sco_connection_number, t_packet sco_packet, u_int32 num_sco_frames);
extern t_error _TP_LIH_Tester_Remove_SCO(u_int8 sco_connection_number);

extern t_error _TP_LIH_SCO_Verify_Data_Packets(
    u_int8 sco_connection_number, u_int8 role, t_packet sco_packet, u_int32 num_frames);

extern t_error _TP_LIH_SCO_Verify_Change_Packet_Type(
    u_int16 handle, u_int8 role, t_packet sco_packet, u_int32 num_frames);
         
/*
 * Module: test_tp_lih_hold.c        HOLD functions
 */
t_error _TP_LIH_HOLD_Enter_Hold_Mode(u_int16 hold_time, u_int32 hold_instant);
t_error _TP_LIH_HOLD_Verify_Hold_Period(u_int16 hold_time, u_int32 hold_instant,
                           u_int16 number_of_frames_master_no_tx );
void _TP_LIH_HOLD_Process_Hold_Period(u_int16 hold_time, u_int32 hold_instant);

/*
 * Module: test_tp_lih_sniff.c       SNIFF functions
 */
enum {VIA_HCI, VIA_LMP, VIA_AUTOMATIC};
void _TP_LIH_SNIFF_Enter_Sniff_Mode(u_int8 if_mode, u_int16 Dsniff, u_int16 Tsniff, 
    u_int16 Sniff_attempt, u_int16 Sniff_timeout, u_int8 timing_control_flags);
void _TP_LIH_SNIFF_Exit_Sniff_Mode(u_int8 if_mode);
void _TP_LIH_SNIFF_Verify_Sniff_Packets(u_int16 T_Sniff, u_int16 D_Sniff);
void _TP_LIH_SNIFF_Activate_Sniff_For_Intervals(u_int8 if_mode, 
    u_int16 Dsniff, u_int16 Tsniff, u_int16 Sniff_attempt, u_int16 Sniff_timeout, 
    u_int8 timing_control_flags, u_int32 intervals);

/*
 * Module: test_tp_lih_acl.c        ACL functions
 */
extern t_error _TP_LIH_ACL_Verify_Data_Packets(u_int8 role, t_packet acl_packet,
             u_int32 expected_num_packets, u_int32 max_frames);

/*
 * Module: test_tp_prh_bcast.c      Broadcast functions
 */
t_error _TP_PRH_BCAST_Verify_ActiveBroadcast_Packets(t_packet bcast_packet,
    u_int16 poll_period_slots, u_int32 expected_num_packets, u_int8);
t_error _TP_PRH_BCAST_Verify_Broadcast_Packets(t_packet bcast_packet,
    u_int16 poll_period_slots, u_int32 expected_num_packets);

/*
 * Module: test_tp_prh_lih_park.c      Park functions
 */
void Master_Init_Unpark(u_int8 expected_am_addr, u_int8 pm_addr,
     u_int16 handle, u_int16 n_b, u_int16 delta_b, u_int16 t_b,
     u_int8 timing_control_flags, u_int16 d_b);
void Slave_Init_Unpark(u_int8 expected_am_addr,u_int16 handle,
     int Beacon_Length, u_int16 t_b, u_int16 d_b, u_int8 d_access,
     u_int8 t_access, u_int8 n_poll, u_int8 m_access, u_int8 n_accslots);
u_int8* Park_Multiple_Slaves(u_int16 connection_handle[],
     u_int8 num_devices, u_int16 t_b, u_int16 d_b, u_int8 timing_control_flags);

void TP_LIH_PARK_Enter_Park_Mode(u_int8 if_mode, 
    u_int8 timing_control_flags, u_int16 d_b, u_int16 t_b, 
    u_int8 n_b, u_int8 delta_b, u_int8 pm_addr, u_int8 ar_addr, 
    u_int8 n_bsleep, u_int8 d_bsleep, 
    u_int8 d_access, u_int8 t_access, u_int8 n_access_slots, u_int8 n_poll, 
    u_int8 m_access);

void TP_LIH_PARK_Exit_Park_Mode(u_int8 if_mode,
    u_int8 timing_control_flags, u_int16 d_b, u_int16 t_b, 
    u_int16 n_b, u_int16 delta_b, u_int8 pm_addr, u_int8 ar_addr,
    u_int8 n_bsleep, u_int8 d_bsleep, 
    u_int8 d_access, u_int8 t_access, u_int8 n_access_slots, u_int8 n_poll, 
    u_int8 m_access, u_int8 new_am_addr);

void TP_LIH_PARK_Process_Beacon_Intervals_Idle(u_int32 num_intervals,
    u_int8 timing_control_flags, u_int16 d_b, u_int16 t_b, 
    u_int16 n_b, u_int16 delta_b, 
    u_int8 d_access, u_int8 t_access, u_int8 n_access_slots);

void TP_LIH_PARK_Park_Process_N_Beacons_Unpark(u_int8 if_mode, u_int32 num_intervals,
    u_int8 timing_control_flags, u_int16 d_b, u_int16 t_b, 
    u_int8 n_b, u_int8 delta_b, u_int8 pm_addr, u_int8 ar_addr, 
    u_int8 n_bsleep, u_int8 d_bsleep, 
    u_int8 d_access, u_int8 t_access, u_int8 n_access_slots, u_int8 n_poll, 
    u_int8 m_access, u_int8 am_addr);

/*
 * Module: test_tp_prh_sec_eng.c      Security engine functions
 */
extern t_error TP_PRH_SEC_Helper_Enc_Setup_IUT_Master(void);
extern t_error TP_PRH_SEC_Helper_Enc_Setup_IUT_Slave(void);

/*
 * Module: test_tp_prh_sec_pairing.c  Security pairing functions
 */
/* IUT pairs - incorrect PINs */
extern t_error _TP_PRH_SEC_PAIR_BV16C_IUT_Slave_Scenario2(void);

/*
 * Module: test_tp_prh_lih_mss.c
 */
t_error _TP_PRH_LIH_MSS_Role_Switch_Slave_to_Master(
    t_am_addr expected_am_addr, boolean mss_success);
t_error _TP_PRH_LIH_MSS_Role_Switch_Master_to_Slave(
    t_am_addr am_addr, boolean mss_success);

/*
 * Module: test_tp_prh_v12_esco.c   eSCO Functions
 */
void UTut_Create_Default_SYN_Link(void);
void UTut_Create_Default_SYN_Link_To_Slave(void);
void UTut_Create_Default_SYN_Link_To_Master(void);
void UTut_Create_Default_SYN_Link_To_Slave_Auto_Accept(void);
void UTut_Create_Default_SYN_Link_To_Master_Auto_Accept(void);
void UTut_Create_SYN_Link(t_role initiator_role, u_int16 hci_pkt_types,
     u_int32 tx_rate, u_int32 rx_rate, u_int8 latency, u_int8 retrans_effort);
void UTut_Create_SYN_Link_Auto_Accept(t_role initiator_role, u_int16 hci_pkt_types,
     u_int32 tx_rate, u_int32 rx_rate, u_int8 latency, u_int8 retrans_effort);
void UTut_Create_SYN_Link_Specify_Accept(t_role initiator, u_int16 hci_pkt_types, 
        u_int32 tx_rate, u_int32 rx_rate, u_int8 latency, u_int8 retrans, 
        u_int8 auto_accept );
void UTut_Create_SYN_Link_Specify_Accept_And_ContentFormat(t_role initiator, 
	u_int16 hci_pkt_types, u_int32 tx_rate, u_int32 rx_rate, 
	u_int8 latency, u_int8 retrans, u_int8 auto_accept_flag, 
	u_int16 content_format);

void UTut_Transfer_Default_SYN_Packets(void);
void UTut_Transfer_SYN_Packets(u_int16 esco_handle, u_int8 d_esco, u_int8 t_esco,
    u_int8 w_esco, u_int8 tx_pkt_type, u_int8 rx_pkt_type, u_int8 tx_pkt_len,
    u_int8 rx_pkt_len);

void UTut_Change_SYN_Link(t_role initiator_role, u_int16 hci_pkt_types,
     u_int32 tx_rate, u_int32 rx_rate, u_int8 latency, u_int8 retrans_effort);

void UTut_Read_LMP_Handle(void);

void UTut_Disconnect_Default_SYN_Link(void);
void UTut_Disconnect_Default_SYN_Link_To_Slave(void);
void UTut_Disconnect_Default_SYN_Link_To_Master(void);
void UTut_Disconnect_SYN_Link(t_role initiator_role);

void UTut_Get_To_End_Of_SYN_Activity( u_int8 d, u_int8 t, u_int8 w, u_int8 slot_occ, u_int8 tc_flag);

/* 
 * 2 slots for LM to start LC Procedure, 2 slots to perform TDD 
 */
#define MSS_EARLY_START_SLOT_OFFSET_ADJUST (2 + 2)

#endif
